home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes reversed ƒ / Halves scroll reversed.c < prev    next >
Text File  |  1994-04-19  |  3KB  |  78 lines

  1. /**********************************************************************\
  2.  
  3. File:        Halves scroll reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 3
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30.  
  31. pascal short HalvesScrollReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  32.  
  33. /* 2 regions, split down the middle of the screen.  Scroll the screen down in one
  34.    region and up in the other. */
  35.    
  36. pascal short HalvesScrollReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  37. {
  38.     int            x;
  39.     Rect        theTopRect, topdest, theBottomRect, bottomdest;
  40.     Rect        topscrollsource, bottomscrollsource;
  41.     int            cx;
  42.     int            BoxSize;
  43.     
  44.     BoxSize=theWindowHeight/25;
  45.     cx = boundsRect.left + theWindowWidth / 2;
  46.     
  47.     topscrollsource=topdest=bottomscrollsource=bottomdest=boundsRect;
  48.     topscrollsource.left=topdest.left=bottomscrollsource.right=bottomdest.right=cx;
  49.     topdest.bottom=topdest.top+BoxSize;
  50.     bottomdest.top=bottomdest.bottom-BoxSize;
  51.     
  52.     SetRect(&theTopRect, cx, boundsRect.bottom-BoxSize, boundsRect.right, boundsRect.bottom);
  53.     SetRect(&theBottomRect, boundsRect.left, boundsRect.top, cx, boundsRect.top+BoxSize);
  54.     
  55.     for(x = theWindowHeight - BoxSize; x >= 0; x -= BoxSize)
  56.     {
  57.         StartTiming();
  58.         ScrollTheRect(&topscrollsource, 0, BoxSize, 0L);
  59.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  60.                 &theTopRect, &topdest, 0, 0L);
  61.         theTopRect.bottom-=BoxSize;
  62.         theTopRect.top-=BoxSize;
  63.         
  64.         ScrollTheRect(&bottomscrollsource, 0, -BoxSize, 0L);
  65.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  66.                 &theBottomRect, &bottomdest, 0, 0L);
  67.         theBottomRect.top+=BoxSize;
  68.         theBottomRect.bottom+=BoxSize;
  69.         
  70.         TimeCorrection(CorrectTime);
  71.     }
  72.     
  73.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  74.         &boundsRect, &boundsRect, 0, 0L);
  75.     
  76.     return 0;
  77. }
  78.